package com.lf.api.util;

import java.io.IOException;
import java.util.Properties;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public final class IFConfig {
	private static Logger log = LoggerFactory.getLogger(IFConfig.class);
	private static Properties prop = new Properties();
	static{
		
		try {
			prop.load(IFConfig.class.getClassLoader().getResourceAsStream("config/lf.properties"));
		} catch (IOException e) {
			log.error("load if.properties error! message:{}", e.getMessage());
			e.printStackTrace();
		}
	}
	
	public static String getValue(String key, String defaultValue){
		String value = prop.getProperty(key);
		return StringUtils.isEmpty(value) ? defaultValue : value;
	}
	
	public static int getValue(String key, int defaultValue){
		String value = prop.getProperty(key);
		return StringUtils.isEmpty(value) ? defaultValue : Integer.valueOf(value);
	}
}
